package com.czy.fx.day1.pane.AnchorPane;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class demo1 extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("标题");
        primaryStage.setWidth(800);
        primaryStage.setHeight(800);
        AnchorPane anchorPane = new AnchorPane();
        primaryStage.setScene(new Scene(anchorPane));

        anchorPane.setStyle("-fx-background-color: #EE1169");
        Button b1 = new Button("b1");
        b1.setPrefWidth(50);
        b1.setPrefHeight(50);
        Button b2 = new Button("b2");
        anchorPane.getChildren().add(b1);
        //响应式布局 管理子组件的位置，设置上边界距离
        AnchorPane.setTopAnchor(b1,10.0);
        AnchorPane.setLeftAnchor(b1,10.0);
        AnchorPane.setBottomAnchor(b1,10.0);
        AnchorPane.setRightAnchor(b1,10.0);

        primaryStage.show();
    }
}
